home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 45.8 KB | 1,523 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UDemoDialogs.cp
- // Copyright © 1988-96 by Apple Computer, Inc. All rights reserved.
- //----------------------------------------------------------------------------------------
-
- #ifndef __UDEMODIALOGS__
- #include "UDemoDialogs.h"
- #endif
-
- // DemoDialogs
-
- #ifndef __USTRUCTUREINSPECTORS__
- #include "UStructureInspectors.h"
- #endif
-
- // MacApp
-
- #ifndef __UCONTROL__
- #include "UControl.h"
- #endif
-
- #ifndef __UDRAWINGENVIRONMENT__
- #include "UDrawingEnvironment.h"
- #endif
-
- #ifndef __UFAILURE__
- #include "UFailure.h"
- #endif
-
- #ifndef __UGEOMETRY__
- #include "UGeometry.h"
- #endif
-
- #ifndef __UKEYSELECTIONBEHAVIOR__
- #include "UKeySelectionBehavior.h"
- #endif
-
- #ifndef __UMACAPPUTILITIES__
- #include "UMacAppUtilities.h"
- #endif
-
- #ifndef __UMEMORY__
- #include "UMemory.h"
- #endif
-
- #ifndef __UMENUMGR__
- #include "UMenuMgr.h"
- #endif
-
- #ifndef __UPOPUP__
- #include "UPopup.h"
- #endif
-
- #ifndef __UPRINTING__
- #include "UPrinting.h"
- #endif
-
- #ifndef __USCROLLER__
- #include "UScroller.h"
- #endif
-
- #ifndef __USUBSTITUTION__
- #include "USubstitution.h"
- #endif
-
- #ifndef __UTABBEHAVIORS__
- #include "UTabBehaviors.h"
- #endif
-
- #ifndef __UTEVIEW__
- #include "UTEView.h"
- #endif
-
- #ifndef __UVIEWSERVER__
- #include "UViewServer.h"
- #endif
-
- #ifndef __UWINDOW__
- #include "UWindow.h"
- #endif
-
- // Toolbox
-
- #ifndef __FONTS__
- #include <Fonts.h>
- #endif
-
- #ifndef __FP__
- #include <fp.h>
- #endif
-
- #ifndef __MENUS__
- #include <Menus.h>
- #endif
-
- #ifndef __OSUTILS__
- #include <OSUtils.h>
- #endif
-
- #ifndef __PACKAGES__
- #include <Packages.h>
- #endif
-
- #ifndef __RESOURCES__
- #include <Resources.h>
- #endif
-
- #ifndef __RESOURCES__
- #include <Resources.h>
- #endif
-
- #ifndef __TOOLUTILS__
- #include <ToolUtils.h>
- #endif
-
- // ANSI
-
- #ifndef __LIMITS__
- #include <limits.h>
- #endif
-
- #ifndef __STDIO__
- #include <stdio.h>
- #endif
-
- #ifndef __STDLIB__
- #include <stdlib.h>
- #endif
-
- //----------------------------------------------------------------------------------------
- // Constants
- const short kDynamicPopup = 300;
-
- const short kNoOfLines = 10000;
- const short kMaxScrollBar = 1000;
- const short kTestIcon = 1000;
- const short kTestAlert = 1000;
- const short kTestPopup = 235;
- const short kBaudPopup = 236;
- const short kParityPopup = 237;
- const short kPopup = 238;
-
- const short kTextStylePopup = 239;
- const short kFontHier = 230;
- const short kStyleHier = 231;
- const short kSizeHier = 232;
-
- const short kTestPicture = 1000;
- const short kTestStatic = 1200;
-
- // Constants for Command Items
- const short cFirstItem = 1001;
- const short cProcedureViews = 1001;
- const short cTemplateViews = 1002;
- const short cMonthlyDialog = 1003;
- const short cSaveDialog = 1004;
- const short cModalBeepDialog = 1005;
- const short cPageSetupDialog = 1006;
- const short cHomeBrewControls = 1007;
- const short cTabbingTest = 1008;
- const short cCalculator = 1009;
- const short cScrollingTest = 1011;
- const short cFormatDialog = 1012;
- const short cModelessBeepDialog = 1013;
- const short cMessageWindoid = 1014;
- const short cBalloons = 1015;
- const short cAdornment = 1016;
- const short cViewInspector = 1017;
- const short cTargetInspector = 1018;
- const short cLastItem = 1018;
- const short cPopupExample = 1100;
- const short cTextStyleChanged = 1102;
- const short cResetTextStyle = 1103;
-
- //----------------------------------------------------------------------------------------
-
- struct FondRecord
- {
- FamRec familyStuff;
- short noOfFonts;
- struct
- {
- short size;
- short style;
- short resID;
- } fontStuff[1001];
- };
-
-
- typedef FondRecord* FondPointer, ** FondHandle;
-
- long gMonthlyValues[13];
- IDType gMonthIDs[13];
-
-
- //========================================================================================
- // Global Functions
- //========================================================================================
- static Boolean GetFontNumber( CStr255& fontName, short& fontNumber );
-
- //========================================================================================
- // CLASS TTestApplication
- //========================================================================================
- #undef Inherited
- #define Inherited TApplication
-
- #pragma segment AInit
- MA_DEFINE_CLASS_M1(TTestApplication, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TTestApplication destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TTestApplication::~TTestApplication()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::ITestApplication:
- //----------------------------------------------------------------------------------------
- #pragma segment AInit
-
- void TTestApplication::ITestApplication()
-
- {
- const char* monthIDs = "jan feb mar apr may jun jul aug sep oct nov dec ";
-
-
- IApplication(kFileType, kSignature);
-
- fLaunchWithNewDocument = FALSE; // Suppress the creation of a new document at launch
-
- for (short i = 0; i < 12; i++)
- {
- gMonthlyValues[i] = (i + 1) * 100;
- }
-
- MABlockMove(monthIDs, (Ptr)gMonthIDs, sizeof(gMonthIDs));
-
- // Suppress dead-stripping of the following classes
- MA_REGISTER_CLASS(TDrawingEnvironment);
- MA_REGISTER_CLASS(TMonthlyDialog);
- MA_REGISTER_CLASS(TArrowsControl);
- MA_REGISTER_CLASS(TTemperatureCluster);
- MA_REGISTER_CLASS(TTemperatureConversionCluster);
- MA_REGISTER_CLASS(TSlider);
- MA_REGISTER_CLASS(TFontListView);
- MA_REGISTER_CLASS(TSizeListView);
- MA_REGISTER_CLASS(TRadioIcon);
- MA_REGISTER_CLASS(TPageSetupDialog);
- MA_REGISTER_CLASS(TSumStaticText);
- MA_REGISTER_CLASS(TCalcDialog);
- MA_REGISTER_CLASS(TNumbersView);
- MA_REGISTER_CLASS(TNumberListView);
- MA_REGISTER_CLASS(TViewHierarchyView);
- MA_REGISTER_CLASS(TTargetChainView);
- MA_REGISTER_CLASS(TModelessBeepDialog);
- MA_REGISTER_CLASS(TScrollBar);
-
- MA_REGISTER_CLASS(TAdornmentDemo);
- MA_REGISTER_CLASS(TEmbossedFrame);
- MA_REGISTER_CLASS(TGrayFill);
- MA_REGISTER_CLASS(TEtchedFrame);
- MA_REGISTER_CLASS(TSlowScroller);
-
-
- MA_REGISTER_SIGNATURE(TEmbossedFrame, 'embo');
- MA_REGISTER_SIGNATURE(TGrayFill, 'gray');
- MA_REGISTER_SIGNATURE(TEtchedFrame, 'etch');
- MA_REGISTER_SIGNATURE(TRoundView, 'rndV');
-
- // to demonstrate support of dynamic menus with TPopup
- CStr255 menuName = "Fonts:";
- fMenuRef = NewMenu(kDynamicPopup, menuName);
- FailNIL(fMenuRef);
- AppendResMenu(fMenuRef, 'FONT');
- MAInsertInMenuTable(fMenuRef, kDynamicPopup);
-
- /* TSwallowBehavior* aSwallowBehavior = new TSwallowBehavior;*/
- /* aSwallowBehavior->IBehavior(kNoIdentifier);*/
- /* this->AddBehavior(aSwallowBehavior);*/
- } // TTestApplication::ITestApplication
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::DoMakeDocument:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- TDocument* TTestApplication::DoMakeDocument(CommandNumber /*itsCommandNumber*/,
- TFile* /*itsFile*/ )// override
-
- {
- return NULL;
- } // TTestApplication::DoMakeDocument
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakeProcedureViews:
- //----------------------------------------------------------------------------------------
- #pragma segment ASelCommand
-
- void TTestApplication::MakeProcedureViews(CommandNumber aCommandNumber)
-
- {
- TextStyle aTextStyle;
- short i;
- CRGBColor aColor;
- VPoint itsLocation;
- VPoint itsSize;
- TextStyle ts;
- TWindow * aWindow;
- TView * aTestView;
- TCluster * aCluster;
- TRadio * aRadio[8];
- TButton * aButton;
- TIcon * anIcon;
- TCheckBox * aCheckBox;
- TPopup * aPopup;
- TPicture * aPicture;
- TStaticText * aStaticText;
- TEditText * anEditText;
- VRect itsInset;
- VPoint itsInsetDelta;
- CPoint aPoint;
- const CStr255 StyleName[8] = {"Plain", "Bold", "Italic", "Underline",
- "Outline", "Shadow", "Condense", "Extend"};
- const CStr255 ParamSubs0 = "^0";
- const CStr255 ParamSubs1 = "^1";
- const CStr255 ExpansionSubs0 = "PARAM0";
- const CStr255 ExpansionSubs1 = "PARAM1";
-
- aTestView = new TView;
- itsSize = VPoint(480, 1200);
- aTestView->IView(NULL, NULL, gZeroVPt, itsSize, sizeFixed, sizeFixed);
- MAParamText(ParamSubs0, ExpansionSubs0);
- MAParamText(ParamSubs1, ExpansionSubs1);
-
- FailNIL(aWindow = gViewServer->NewSimpleWindow((short)aCommandNumber, TRUE, TRUE, NULL, aTestView));
- aWindow->fFreeOnClosing = TRUE;
-
- aStaticText = new TStaticText;
- itsLocation = VPoint(50, 100);
- itsSize = VPoint(300, 150);
- aStaticText->IStaticText(aTestView, itsLocation, itsSize, sizeVariable, sizeVariable, kTestStatic, 1);
- SetRGBColor(aColor, 0, 0, 0xFFFF);
- SetTextStyle(ts, applFont, italic, 12, aColor);
- aStaticText->InstallTextStyle(ts, kDontRedraw);
- aStaticText->SetJustification(teCenter, kRedraw);
-
- aCluster = new TCluster;
- itsLocation = VPoint(100, 340);
- itsSize = VPoint(150, 190);
- aCluster->ICluster(aTestView, itsLocation, itsSize, sizeVariable, sizeVariable, kNoResource, 0);
- aCluster->SetLabel("A Cluster!", kRedraw);
-
- itsSize = VPoint(130, 20);
- for (i = 0; i < 8; i++)
- {
- aRadio[i] = new TRadio;
- itsLocation = VPoint(10, (i + 1) * 20);
- aRadio[i]->IRadio(aCluster, itsLocation, itsSize, sizeVariable, sizeVariable, gEmptyString, i == 2);
- SetTextStyle(ts, systemFont, Style((1 << i) / 2), 12, gRGBBlack);
- aRadio[i]->InstallTextStyle(ts, kDontRedraw);
- aRadio[i]->SetText(StyleName[i], kRedraw);
- }
-
- aCheckBox = new TCheckBox;
- itsLocation = VPoint(100, 540);
- itsSize = VPoint(100, 20);
- aCheckBox->ICheckBox(aTestView, itsLocation, itsSize, sizeVariable, sizeVariable, "Check Box", FALSE);
- SetTextStyle(ts, applFont, 0, 12, gRGBBlack);
- aCheckBox->InstallTextStyle(ts, kRedraw);
-
- aButton = new TButton;
- itsLocation = VPoint(270, 540);
- itsSize = VPoint(100, 28);
- aButton->IButton(aTestView, itsLocation, itsSize, sizeVariable, sizeVariable, "Push Button");
- SetTextStyle(ts, applFont, NULL, 10, gRGBBlack);
- aButton->InstallTextStyle(ts, kDontRedraw);
- aButton->SetPenSize(CPoint(3, 3));
- aButton->SetAdornment(adnRRect, kDontRedraw);
- itsInsetDelta = VPoint(4, 4);
- aButton->Inset(itsInsetDelta, kRedraw);
-
- anIcon = new TIcon;
- itsLocation = VPoint(130, 570);
- itsSize = VPoint(35, 35);
- anIcon->IIcon(aTestView, itsLocation, itsSize, sizeFixed, sizeFixed, kTestIcon, kPreferColor);
- anIcon->SetAdornment(kFrame | adnShadow, kDontRedraw);
-
- anIcon->ViewEnable(TRUE, kDontRedraw);
- itsInset = VRect(1, 1, 1, 1);
- anIcon->SetInset(itsInset, kDontRedraw);
-
- aPopup = new TPopup; // test popup
- itsLocation = VPoint(290, 589);
- itsSize = VPoint(120, 22);
- aPopup->IPopup(aTestView, itsLocation, itsSize, sizeVariable, sizeVariable, kTestPopup, 2, 50, cPopupExample, 1, NULL, teJustLeft, kDontUseAddResMenu, kNoIdentifier);
-
- aPopup = new TPopup; // baud popup
- itsLocation = VPoint(290, 624);
- itsSize = VPoint(120, 22);
- aPopup->IPopup(aTestView, itsLocation, itsSize, sizeVariable, sizeVariable, kBaudPopup, 1, 50, cPopupExample, 2, NULL, teJustLeft, kDontUseAddResMenu, kNoIdentifier);
-
- aPopup = new TPopup; // parity popup
- itsLocation = VPoint(290, 659);
- itsSize = VPoint(120, 22);
- aPopup->IPopup(aTestView, itsLocation, itsSize, sizeVariable, sizeVariable, kParityPopup, 1, 50, cPopupExample, 3, 0, teJustLeft, kDontUseAddResMenu, kNoIdentifier);
- SetTextStyle(aTextStyle, applFont, NULL, 9, gRGBBlack);
- aPopup->fTextStyle = aTextStyle;
-
- aPicture = new TPicture;
- itsLocation = VPoint(100, 660);
- itsSize = VPoint(0x18C - 0xF0 + 16, 0x12C - 0x8F + 16);
- aPicture->IPicture(aTestView, itsLocation, itsSize, sizeVariable, sizeVariable, kTestPicture);
- // aPicture->fPenSize = CPoint(0x00020002);
- aPicture->SetAdornment(adnRRect | adnShadow, kDontRedraw);
- aPicture->ViewEnable(TRUE, kDontRedraw);
- itsInsetDelta = VPoint(8, 8);
- aPicture->Inset(itsInsetDelta, kDontRedraw);
- aPicture->SetLocalOrigin(VPoint(50, 50), kDontRedraw);
- aPicture->UpdateCoordinates();
-
-
- anEditText = new TEditText;
- itsLocation = VPoint(140, 620);
- itsSize = VPoint(100, 22);
- anEditText->IEditText(aTestView, itsLocation, itsSize, 255);
- SetTextStyle(ts, applFont, 0, 12, gRGBBlack);
- anEditText->InstallTextStyle(ts, kDontRedraw);
- anEditText->SetJustification(teFlushRight, kDontRedraw);
- anEditText->SetText("EditText", kDontRedraw);
-
- aWindow->Open();
- } // TTestApplication::MakeProcedureViews
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::DoMenuCommand:
- //----------------------------------------------------------------------------------------
- #pragma segment ASelCommand
-
- void TTestApplication::DoMenuCommand(CommandNumber aCommandNumber)// override
-
-
- {
- switch (aCommandNumber)
- {
- case cProcedureViews:
- MakeProcedureViews(aCommandNumber);
- break;
- case cTemplateViews:
- MakeTemplateViews(aCommandNumber);
- break;
- case cScrollingTest:
- MakeScrollingTest(aCommandNumber);
- break;
- case cMonthlyDialog:
- MakeMonthlyDialog(aCommandNumber);
- break;
- case cSaveDialog:
- MakeSaveDialog(aCommandNumber);
- break;
- case cModalBeepDialog:
- MakeModalBeepDialog(aCommandNumber);
- break;
- case cModelessBeepDialog:
- MakeDialog(aCommandNumber);
- break;
- case cMessageWindoid:
- MakeDialog(aCommandNumber);
- break;
- case cViewInspector:
- case cTargetInspector:
- {
- TWindow * aWindow;
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- aWindow->SetResizeLimits(CPoint(210,180),CPoint(210,1000));
- aWindow->Open();
- }
- break;
- case cBalloons:
- MakeBalloonWindow(aCommandNumber);
- break;
- case cAdornment:
- MakeDialog(aCommandNumber);
- break;
- case cFormatDialog:
- MakeFormatDialog(aCommandNumber);
- break;
- case cPageSetupDialog:
- MakePageSetupDialog(aCommandNumber);
- break;
- case cHomeBrewControls:
- MakeHomeBrewDialog(aCommandNumber);
- break;
- case cTabbingTest:
- MakeDialog(aCommandNumber);
- break;
- case cCalculator:
- MakeCalculator(aCommandNumber);
- break;
- default:
- Inherited::DoMenuCommand(aCommandNumber);
- break;
- }
- } // TTestApplication::DoMenuCommand
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::DoSetupMenus:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TTestApplication::DoSetupMenus()// override
-
- {
- Inherited::DoSetupMenus();
-
- for (short i = cFirstItem; i <= cLastItem; i++)
- Enable(i, TRUE);
-
- Enable(cAdornment, HasColorQD());
-
- // If the Dynamic menu is not in the menubar then insert it
- if (::GetMenuHandle((*fMenuRef)->menuID) == NULL)
- MAInsertMenu(fMenuRef, (*fMenuRef)->menuID, -1);
-
- } // TTestApplication::DoSetupMenus
-
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakeTemplateViews:
- //----------------------------------------------------------------------------------------
- void TTestApplication::MakeTemplateViews(CommandNumber aCommandNumber)
-
- {
- TWindow * aWindow;
- TDialogView * aDialogView;
- TPopup * aPopup;
-
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- aDialogView = (TDialogView *)(aWindow->FindSubView('DLOG'));
-
-
- TStdPrintHandler* aPrintHandler = new TStdPrintHandler;
- aPrintHandler->IStdPrintHandler(NULL, // its document
- aDialogView, // its view
- !kFixedSize, // horizontal page size is variable
- kFixedSize); // vertical page size is fixed
-
-
- FailNIL(aPopup = (TPopup *)(gViewServer->DoCreateViews(NULL, aDialogView, cPopupExample, gZeroVPt)));
- MAParamText("^0", "PARAM0");
- MAParamText("^1", "PARAM1");
- aWindow->Open();
- } // TTestApplication::MakeTemplateViews
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakeScrollingTest:
- //----------------------------------------------------------------------------------------
- void TTestApplication::MakeScrollingTest(CommandNumber aCommandNumber)
-
- {
- TWindow * aWindow;
- CPoint minSize;
-
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- SetPt(minSize, 315, 260);
- aWindow->SetResizeLimits(minSize, aWindow->fResizeLimits[botRight]);
- aWindow->Open();
- } // TTestApplication::MakeScrollingTest
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakeMonthlyDialog:
- //----------------------------------------------------------------------------------------
- void TTestApplication::MakeMonthlyDialog(CommandNumber aCommandNumber)
-
- {
- TWindow * aWindow;
- TMonthlyDialog * aMonthlyDialog;
- TViewTabber * aTabber;
-
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- aMonthlyDialog = (TMonthlyDialog *)(aWindow->FindSubView('DLOG'));
- if (aMonthlyDialog != NULL)
- aMonthlyDialog->StuffValues();
-
- // Add a tabbing behavior to the window. This shows how to prevent cross-window
- // tabbing when there are floating windows present
- aTabber = new TViewTabber;
- aTabber->ITabber(TRUE);
- aWindow->AddBehavior(aTabber);
-
- aWindow->Open();
- } // TTestApplication::MakeMonthlyDialog
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakeSaveDialog:
- //----------------------------------------------------------------------------------------
- void TTestApplication::MakeSaveDialog(CommandNumber aCommandNumber)
-
- {
- TWindow * aWindow;
- IDType dismisser;
-
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- dismisser = aWindow->PoseModally();
-
- #if qDebug
- if (dismisser == 'yes ')
- fprintf(stderr, "The user said yes.\n");
- else if (dismisser == 'no ')
- fprintf(stderr, "The user said no.\n");
- else if (dismisser == 'cncl')
- fprintf(stderr, "The user cancelled the dialog.\n");
- else
- fprintf(stderr, "I don't know how the user responded\n");
- #endif
-
- aWindow->Close();
- aWindow->Free();
- } // TTestApplication::MakeSaveDialog
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakeModalBeepDialog:
- //----------------------------------------------------------------------------------------
- void TTestApplication::MakeModalBeepDialog(CommandNumber aCommandNumber)
-
- {
- TWindow * aWindow;
- IDType dismisser;
- long n;
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- dismisser = aWindow->PoseModally();
- if (dismisser == 'ok ')
- n = ((TNumberText *)(aWindow->FindSubView('numb')))->GetValue();
- else
- n = 0;
- aWindow->CloseAndFree();
- for (long i = 1; i <= n; i++)
- gApplication->Beep(2);
- } // TTestApplication::MakeModalBeepDialog
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakeDialog:
- //----------------------------------------------------------------------------------------
- void TTestApplication::MakeDialog(CommandNumber aCommandNumber)
-
- {
- TWindow * aWindow;
-
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- aWindow->Open();
- } // TTestApplication::MakeDialog
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakeBalloonWindow:
- //----------------------------------------------------------------------------------------
- void TTestApplication::MakeBalloonWindow(CommandNumber aCommandNumber)
- {
- TWindow * aWindow;
- TView * aSubView;
-
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- aSubView = aWindow->FindSubView('ADN1');
- aSubView->fHelpID = 128;
- aSubView->fHelpIndex = 1;
- aSubView->fCursorID = plusCursor;
-
- aSubView = aWindow->FindSubView('ADN2');
- aSubView->fHelpID = 128;
- aSubView->fHelpIndex = 2;
- aSubView->fHandlesCursor = FALSE;
-
- aSubView = aWindow->FindSubView('ADN3');
- aSubView->fHelpID = 128;
- aSubView->fHelpIndex = 3;
-
- aWindow->Open();
- } // TTestApplication::MakeBalloonWindow
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakeFormatDialog:
- //----------------------------------------------------------------------------------------
- void TTestApplication::MakeFormatDialog(CommandNumber aCommandNumber)
-
- {
- TWindow * aWindow;
- TDialogView * theDialog;
- IDType dismisser;
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- theDialog = (TDialogView *)(aWindow->FindSubView('DLOG'));
- SetupTheFontView(theDialog);
-
- dismisser = aWindow->PoseModally();
- #if qDebug
- if (dismisser != 'ok ')
- fprintf(stderr, "The dialog was cancelled.\n");
- #endif
-
- aWindow->CloseAndFree();
- } // TTestApplication::MakeFormatDialog
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::SetupTheFontView:
- //----------------------------------------------------------------------------------------
- void TTestApplication::SetupTheFontView(TDialogView* theDialog)
-
- {
- TFontListView * theFontListView;
- TSizeListView * theSizeListView;
-
-
- theSizeListView = (TSizeListView *)(theDialog->FindSubView('slst'));
- theSizeListView->fSelection = 0;
- theSizeListView->fSelectedSize = 9;
- theFontListView = (TFontListView *)(theDialog->FindSubView('flst'));
- theFontListView->InitFontList();
- theFontListView->SelectItem(1, kDontExtend, kHighlight, kSelect);
- } // TTestApplication::SetupTheFontView
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakePageSetupDialog:
- //----------------------------------------------------------------------------------------
- void TTestApplication::MakePageSetupDialog(CommandNumber aCommandNumber)
-
- {
- TWindow * aWindow;
- TPageSetupDialog * theDialog;
- IDType dismisser;
-
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- theDialog = (TPageSetupDialog *)(aWindow->FindSubView('DLOG'));
-
- dismisser = aWindow->PoseModally();
- #if qDebug
- if (dismisser == 'ok ')
- {
- }
- else
- fprintf(stderr, "The dialog was cancelled.\n");
- #endif
-
- aWindow->CloseAndFree();
- } // TTestApplication::MakePageSetupDialog
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakeCalculator:
- //----------------------------------------------------------------------------------------
- void TTestApplication::MakeCalculator(CommandNumber aCommandNumber)
-
- {
- TWindow * aWindow;
- TCalcDialog * aCalcDialog;
-
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- aCalcDialog = (TCalcDialog *)(aWindow->FindSubView('DLOG'));
- aCalcDialog->ClearSum();
- aWindow->Open();
- } // TTestApplication::MakeCalculator
-
- //----------------------------------------------------------------------------------------
- // TTestApplication::MakeHomeBrewDialog:
- //----------------------------------------------------------------------------------------
- void TTestApplication::MakeHomeBrewDialog(CommandNumber aCommandNumber)
- {
- TWindow * aWindow;
- TScrollBar * firstScrollBar;
- TScrollBar * secondScrollBar;
- TChangeBehavior * aChangeBehavior;
- TUpdateBehavior * anUpdateBehavior;
-
-
- FailNIL(aWindow = gViewServer->NewTemplateWindow((short)aCommandNumber, NULL));
- firstScrollBar = (TScrollBar *)(aWindow->FindSubView('Scr1'));
- secondScrollBar = (TScrollBar *)(aWindow->FindSubView('Scr2'));
- firstScrollBar->AddDependent(secondScrollBar);
- secondScrollBar->AddDependent(firstScrollBar);
-
- aChangeBehavior = new TChangeBehavior;
- aChangeBehavior->IBehavior(kNoIdentifier);
- firstScrollBar->AddBehavior(aChangeBehavior);
-
- aChangeBehavior = new TChangeBehavior;
- aChangeBehavior->IBehavior(kNoIdentifier);
- secondScrollBar->AddBehavior(aChangeBehavior);
-
- anUpdateBehavior = new TUpdateBehavior;
- anUpdateBehavior->IBehavior(kNoIdentifier);
- firstScrollBar->AddBehavior(anUpdateBehavior);
-
- anUpdateBehavior = new TUpdateBehavior;
- anUpdateBehavior->IBehavior(kNoIdentifier);
- secondScrollBar->AddBehavior(anUpdateBehavior);
-
- aWindow->Open();
- } // TTestApplication::MakeHomeBrewDialog
-
-
- //========================================================================================
- // CLASS TNumbersView
- //========================================================================================
- #undef Inherited
- #define Inherited TView
-
- #pragma segment ARes
- MA_DEFINE_CLASS_M1(TNumbersView, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TNumbersView destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TNumbersView::~TNumbersView()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TNumbersView::ReadFields:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
- void TNumbersView::ReadFields(TStream* aStream)// override
- {
- Inherited::ReadFields(aStream);
- fWantsToBeTarget = TRUE;
- } // TNumbersView::ReadFields
-
- //----------------------------------------------------------------------------------------
- // TNumbersView::Draw:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TNumbersView::Draw(const VRect& area)
- {
- VRect viewRect(area);
- viewRect[botRight] -= VPoint(1, 1);
-
- long firstLine = (viewRect.top / 16) + 1;
- long lastLine = (viewRect.bottom / 16) + 1;
-
- SetPortTextStyle(gSystemStyle);
- for (long i = firstLine; i <= lastLine; i++)
- {
- MoveToPt(ViewToQDPt(VPoint(0, i * 16)));
-
- CStr255 s;
- NumToString(i, s);
- DrawString(s);
- }
- Inherited::Draw(area);
- } // TNumbersView::Draw
-
- //========================================================================================
- // CLASS TNumberListView
- //========================================================================================
- #undef Inherited
- #define Inherited TTextListView
-
- #pragma segment ARes
- MA_DEFINE_CLASS_M1(TNumberListView, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TNumberListView constructor
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- TNumberListView::TNumberListView()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TNumberListView destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TNumberListView::~TNumberListView()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TNumberListView::DoPostCreate:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
- void TNumberListView::DoPostCreate(TDocument* itsDocument)// override
- {
- Inherited::DoPostCreate(itsDocument);
- fWantsToBeTarget = TRUE; // !!! should be set in 3.0 'View' resource
- } // TNumberListView::DoPostCreate
-
- //----------------------------------------------------------------------------------------
- // TNumberListView::BecameWindowTarget:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
- void TNumberListView::BecameWindowTarget()// override
- {
- this->DoHighlightSelection(fActiveHL, hlOn);
- fActiveHL = hlOn;
- Inherited::BecameWindowTarget();
- } // TNumberListView::BecameWindowTarget
-
- //----------------------------------------------------------------------------------------
- // TNumberListView::ResignedWindowTarget:
- //----------------------------------------------------------------------------------------
- void TNumberListView::ResignedWindowTarget()// override
- {
- this->DoHighlightSelection(fActiveHL, hlDim);
- fActiveHL = hlDim;
- Inherited::ResignedWindowTarget();
- } // TNumberListView::ResignedWindowTarget
-
- //----------------------------------------------------------------------------------------
- // TNumberListView::GetItemText:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TNumberListView::GetItemText(short anItem,
- CStr255& aString)// override
- {
- NumToString(anItem, aString);
- } // TNumberListView::GetItemText
-
-
-
- //========================================================================================
- // CLASS TModelessBeepDialog
- //========================================================================================
- #undef Inherited
- #define Inherited TDialogView
-
- #pragma segment ARes
- MA_DEFINE_CLASS_M1(TModelessBeepDialog, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TModelessBeepDialog destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TModelessBeepDialog::~TModelessBeepDialog()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TModelessBeepDialog::DoEvent:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TModelessBeepDialog::DoEvent(EventNumber eventNumber,
- TEventHandler* source,
- TEvent* event)// override
- {
- long i;
- long maxi;
-
- switch (eventNumber)
- {
- case mButtonHit: // Default button and Enter or Return key
- {
- maxi = ((TNumberText *)(FindSubView('numb')))->GetValue();
- if (this->IsHierarchyValid())
- for (i = 1; i <= maxi; i++)
- gApplication->Beep(2);
- break;
- }
- default:
- Inherited::DoEvent(eventNumber, source, event);
- }
- } // TModelessBeepDialog::DoEvent
-
-
- //========================================================================================
- // CLASS TMonthlyDialog
- //========================================================================================
- #undef Inherited
- #define Inherited TDialogView
-
- #pragma segment ARes
- MA_DEFINE_CLASS_M1(TMonthlyDialog, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TMonthlyDialog destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TMonthlyDialog::~TMonthlyDialog()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TMonthlyDialog::Close:
- //----------------------------------------------------------------------------------------
- #pragma segment AClose
-
- void TMonthlyDialog::Close() // override
-
- {
-
- if (this->IsHierarchyValid())
- {
- for (short i = 0; i < 12; i++)
- {
- gMonthlyValues[i] = ((TNumberText *)FindSubView(gMonthIDs[i]))->GetValue();
- Inherited::Close();
- }
-
- }
- else
- Failure(noErr, 0); // Silent Failure
-
- } // TMonthlyDialog::Close
-
- //----------------------------------------------------------------------------------------
- // TMonthlyDialog::DoKeyEvent:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TMonthlyDialog::DoKeyEvent(TToolboxEvent* event)// override
- {
- // If option-tab is pressed, deselect the current edit text and leave nothing
- // selected. This is for test purposes only. It is not part of the Macintosh user
- // interface.
- if ((event->fText == chTab) && (event->IsOptionKeyPressed()))
- GetWindow()->BecomeTarget(); // Formerly: DoSelectEditText(NULL, FALSE);
- else
- Inherited::DoKeyEvent(event);
- } // TMonthlyDialog::DoKeyEvent
-
- //----------------------------------------------------------------------------------------
- // TMonthlyDialog::StuffValues:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TMonthlyDialog::StuffValues()
- {
- for (short i = 0; i < 12; i++)
- ((TNumberText *)FindSubView(gMonthIDs[i]))->SetValue(gMonthlyValues[i], kDontRedraw);
- } // TMonthlyDialog::StuffValues
-
-
- //========================================================================================
- // GLOBAL Procedures
- //========================================================================================
- #undef Inherited
-
- //----------------------------------------------------------------------------------------
- // GetFontNumber:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- // From IM-VI p. 12-16:
-
- Boolean GetFontNumber( CStr255& fontName, short& fontNumber )
- {
- GetFNum( fontName, &fontNumber );
- if( fontNumber == 0 )
- {
- CStr255 systemFontName;
-
- // Either the font was not found, or it is the system font
-
- GetFontName( 0, systemFontName );
- return systemFontName == fontName;
- }
-
- return TRUE;
- } // GetFontNumber
-
-
- //========================================================================================
- // CLASS TFontListView
- //========================================================================================
- #undef Inherited
- #define Inherited TTextListView
-
- #pragma segment AOpen
- MA_DEFINE_CLASS_M1(TFontListView, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TFontListView::DoPostCreate:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TFontListView::DoPostCreate(TDocument* itsDocument)// override
-
- {
- Inherited::DoPostCreate(itsDocument);
- fWantsToBeTarget = TRUE;
- } // TFontListView::DoPostCreate
-
- //----------------------------------------------------------------------------------------
- // TFontListView::InitFontList:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TFontListView::InitFontList()
-
- {
- TKeySelectionBehavior * behavior;
- FontListPtr pFondIDs;
- short i;
- short noOfFonds;
- CStr255 aString;
-
- behavior = new TKeySelectionBehavior;
- behavior->IKeySelectionBehavior('KYSL');
- AddBehavior(behavior);
-
- fFontList = NULL;
- noOfFonds = CountResources('FOND');
- if (noOfFonds > kMaxFonds)
- noOfFonds = kMaxFonds;
- pFondIDs = FontListPtr(NewPermPtr( (noOfFonds + 1) * 2)); // Our indexing scheme is one-based
- // element zero is unused, so we'd better get one more item
-
- aString = " ";
- for (i = 1; i <= noOfFonds; i++)
- { // put each FOND's id in the list…
- (*pFondIDs)[i] = FondAfter(aString, noOfFonds); // …in alphabetical order
- if (aString.Length() == 0) // we finished early
- {
- noOfFonds = i - 1;
- break;
- }
- }
-
- fFontList = pFondIDs;
- InsRowLast(noOfFonds, 16);
- } // TFontListView::InitFontList
-
- //----------------------------------------------------------------------------------------
- // TFontListView::FondAfter:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- short TFontListView::FondAfter(CStr255& fontName,
- short noOfFonds)
- // Find the FOND whose name follows fontName alphabetically, and return its id and name
-
- {
- Handle theFondResource;
- short lastID;
- short thisResID;
- short thisID;
- ResType itsType;
- short index;
- Boolean foundFOND;
- CStr255 lastName;
- CStr255 thisName;
-
-
- foundFOND = FALSE;
- lastName = "~~~~~~~~";
- lastID = 0;
- for (index = 1; index <= noOfFonds; index++)
- {
- theFondResource = GetIndResource('FOND', index);
- GetResInfo(theFondResource, &thisResID, &itsType, thisName);
- if( GetFontNumber( thisName, thisID ) ) // Remember the font number, not its resource ID
- {
- if ((thisName > fontName) && (thisName < lastName))
- {
- lastID = thisID;
- lastName = thisName;
- foundFOND = TRUE;
- }
- }
- }
- if (foundFOND)
- fontName = lastName;
- else // Skip duplicate FOND names
- fontName.Empty();
- return lastID;
- } // TFontListView::FondAfter
-
- //----------------------------------------------------------------------------------------
- // TFontListView::Free:
- //----------------------------------------------------------------------------------------
- #pragma segment AClose
-
- TFontListView::~TFontListView() // override
-
- {
- fFontList = (FontListPtr) DisposeIfPtr ((Ptr)fFontList);
- } // TFontListView::Free
-
- //----------------------------------------------------------------------------------------
- // TFontListView::GetItemText:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TFontListView::GetItemText(short anItem,
- CStr255& aString)
- {
- GetFontName( (*fFontList)[anItem], aString );
- } // TFontListView::GetItemText
-
- //----------------------------------------------------------------------------------------
- // TFontListView::SelectItem:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TFontListView::SelectItem(short anItem,
- Boolean extendSelection,
- Boolean highlight,
- Boolean select)
- {
- TView * aView;
-
- Inherited::SelectItem(anItem, extendSelection, highlight, select);
-
- if (select)
- {
- aView = ((TView *)GetWindow())->FindSubView('slst');
- FailNILResource((Handle)aView);
- ((TSizeListView *)aView)->InstallFontFamily((*fFontList)[anItem]);
- }
- } // TFontListView::SelectItem
-
-
- //========================================================================================
- // CLASS TSizeListView
- //========================================================================================
- #undef Inherited
- #define Inherited TTextListView
-
- #pragma segment ARes
- MA_DEFINE_CLASS_M1(TSizeListView, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TSizeListView destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TSizeListView::~TSizeListView()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TSizeListView::GetItemText:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TSizeListView::GetItemText(short anItem,
- CStr255& aString) // override
- {
- NumToString( fFontSizeList[anItem - 1], aString);
- } // TSizeListView::GetItemText
-
- //----------------------------------------------------------------------------------------
- // TSizeListView::InstallFontFamily:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TSizeListView::InstallFontFamily(short theFontNumber)
- {
- short noOfSizes;
- short sizeToSelect;
-
- noOfSizes = 0;
- sizeToSelect = 0;
-
- // We only check a specific set of Font sizes, as recommended in IM VI p. 12-15
- for( short fontSize = 9; fontSize <= 96; ++fontSize )
- {
- // Check the same set of font sizes that MPW does: every point size from 9 to 24,
- // then every 6th point size up to size 96.
- if( (fontSize <= 24) || (fontSize % 6 == 0) )
- {
- // If this font size is available & there is room in the table…
- if( RealFont( theFontNumber, fontSize ) && (noOfSizes < kMaxSizes) )
- {
- // …then remember this value
- fFontSizeList[noOfSizes] = fontSize;
-
- noOfSizes = noOfSizes + 1;
- if( fontSize == fSelectedSize )
- sizeToSelect = noOfSizes;
- }
- }
- }
-
- SetNumberOfItems(noOfSizes);
- SelectItem(sizeToSelect, kDontExtend, kDontHighlight, kSelect);
- ForceRedraw();
- } // TSizeListView::InstallFontFamily
-
- //----------------------------------------------------------------------------------------
- // TSizeListView::SelectItem:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TSizeListView::SelectItem(short anItem,
- Boolean extendSelection,
- Boolean highlight,
- Boolean select)// override
- {
- CStr255 aString;
- TNumberText * theSizeView;
- long fontSize;
-
-
- Inherited::SelectItem(anItem, extendSelection, highlight, select);
-
- if (select && (anItem != 0))
- {
- GetItemText(anItem, aString);
- theSizeView = (TNumberText *)(GetWindow()->FindSubView('size'));
- theSizeView->SetText(aString, kRedraw);
- theSizeView->SetSelection(0, SHRT_MAX, kRedraw);
- StringToNum(aString, &fontSize);
- fSelectedSize = (short)fontSize;
- }
- } // TSizeListView::SelectItem
-
- //----------------------------------------------------------------------------------------
- // TSizeListView::SetNumberOfItems:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TSizeListView::SetNumberOfItems(short aNumber)
- {
- SelectItem(0, kDontExtend, kHighlight, kSelect);
-
- if (fNumOfRows > aNumber)
- {
- DelItemFirst(fNumOfRows - aNumber);
- }
- else if (fNumOfRows < aNumber)
- {
- InsItemFirst(aNumber - fNumOfRows);
- }
- } // TSizeListView::SetNumberOfItems
-
-
- //========================================================================================
- // CLASS TPageSetupDialog
- //========================================================================================
- #undef Inherited
- #define Inherited TDialogView
-
- #pragma segment ARes
- MA_DEFINE_CLASS_M1(TPageSetupDialog, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TPageSetupDialog constructor
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- TPageSetupDialog::TPageSetupDialog()
- {
- fOrientation = vSel;
- fTallAdjusted = NULL;
- fVerticalOrientation = NULL;
- fHorizontalOrientation = NULL;
- } // TPageSetupDialog::TPageSetupDialog
-
- //----------------------------------------------------------------------------------------
- // TPageSetupDialog destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TPageSetupDialog::~TPageSetupDialog()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TPageSetupDialog::DoPostCreate:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- void TPageSetupDialog::DoPostCreate(TDocument* itsDocument)
- {
- Inherited::DoPostCreate(itsDocument);
-
- fTallAdjusted = (TCheckBox *)(this->FindSubView('tall'));
- fVerticalOrientation = (TRadioIcon *)(this->FindSubView('vert'));
- fHorizontalOrientation = (TRadioIcon *)(this->FindSubView('horz'));
-
- fVerticalOrientation->HiliteState(fOrientation == vSel, kDontRedraw);
- fHorizontalOrientation->HiliteState(fOrientation == hSel, kDontRedraw);
- } // TPageSetupDialog::DoPostCreate
-
- //----------------------------------------------------------------------------------------
- // TPageSetupDialog::DoEvent:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TPageSetupDialog::DoEvent(EventNumber eventNumber,
- TEventHandler* source,
- TEvent* event)// override
- {
- VHSelect newOrientation;
-
- switch (eventNumber)
- {
- case mIconHit:
- {
- if (source == fVerticalOrientation)
- newOrientation = vSel;
- else
- newOrientation = hSel;
- if (newOrientation != fOrientation)
- {
- fVerticalOrientation->HiliteState(newOrientation == vSel, kRedraw);
- fHorizontalOrientation->HiliteState(newOrientation == hSel, kRedraw);
- fTallAdjusted->DimState(newOrientation == hSel, kRedraw);
- fTallAdjusted->SetState(FALSE, kRedraw);
- fOrientation = newOrientation;
- }
- break;
- }
- default:
- Inherited::DoEvent(eventNumber, source, event);
- } // switch
- } // TPageSetupDialog::DoEvent
-
-
-
- //========================================================================================
- // CLASS TRadioIcon
- //========================================================================================
- #undef Inherited
- #define Inherited TIcon
-
- #pragma segment ARes
- MA_DEFINE_CLASS_M1(TRadioIcon, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TRadioIcon destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TRadioIcon::~TRadioIcon()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TRadioIcon::TrackMouse:
- //----------------------------------------------------------------------------------------
- #pragma segment ADoCommand
-
- void TRadioIcon::TrackMouse(TrackPhase aTrackPhase,
- VPoint& /*anchorPoint*/,
- VPoint& /*previousPoint*/,
- VPoint& /*nextPoint*/,
- Boolean /*mouseDidMove*/)// override
- {
- if (aTrackPhase == trackBegin)
- this->HandleEvent(mIconHit, this, NULL);
-
- } // TRadioIcon::TrackMouse
-
-
- //========================================================================================
- // CLASS TRoundView
- //========================================================================================
- #undef Inherited
- #define Inherited TControl
-
- #pragma segment ARes
- MA_DEFINE_CLASS_M1(TRoundView, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TRoundView constructor
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- TRoundView::TRoundView()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TRoundView destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TRoundView::~TRoundView()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TRoundView::Draw
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TRoundView::Draw(const VRect& area)
- {
- EraseRect(&ViewToQDRect(area));
- }
-
- //----------------------------------------------------------------------------------------
- // TRoundView::GetExtentRegion:
- //----------------------------------------------------------------------------------------
- #pragma segment ARes
-
- void TRoundView::GetExtentRegion(RgnHandle itsExtentRgn)// override
- {
- //
- // This is a simple example of a view that has a non-rectangular region.
- // For simplicity we are actually constructing the region in this method.
- // If we wanted, we could construct the region some other time (ReadFrom/DoPostCreate/etc.)
- // and store it. Then we would simply copy the region in this method.
- //
-
- OpenRgn();
- FrameOval(&GetQDExtent());
- CloseRgn(itsExtentRgn);
- } // TRoundView::GetExtentRegion
-
- //----------------------------------------------------------------------------------------
- // End of UDemoDialogs.cp
-
- #pragma segment Inline
-